.csv
IAM user ID、Secret 添加到 Github repo 的 Secrets 中.github/workflows
資料夾.github/workflows
資料夾下,新增 deployment.yml
檔案name: deployment
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
if: ${{ contains(github.event.head_commit.message, '#deploy') }}
steps:
- uses: actions/checkout@v2
- name: Set up AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_S3_UPLOAD_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_UPLOAD_SECRET }}
aws-region: ap-northeast-1
- name: Upload to S3
run: |
aws s3 sync ./ s3://${{ secrets.AWS_S3_HUGO_BUCKET }}
aws s3 sync
指令,將 public 資料夾下的內容同步到 S3 bucket 中yml
來決定流程